//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "PiecewiseTimeDependentHestonModel.h"
using namespace Cephei::QL::Models::Equity;
#include <gen/QL/Termstructures/YieldTermStructure.h>
#include <gen/QL/Quote.h>
#include <gen/QL/Models/Parameter.h>
#include <gen/QL/TimeGrid.h>
#include <gen/QL/Models/CalibrationHelper.h>
#include <gen/QL/Math/Optimization/OptimizationMethod.h>
#include <gen/QL/Math/Optimization/EndCriteria.h>
#include <gen/QL/Math/Optimization/Constraint.h>
#include <gen/QL/Math/Array.h>
#include <gen/QL/Models/CalibratedModel.h>
using namespace Cephei::QL::Termstructures;
using namespace Cephei::QL;
using namespace Cephei::QL::Models;
using namespace Cephei::QL::Math::Optimization;
using namespace Cephei::QL::Math;
#define HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (Cephei::QL::Termstructures::IYieldTermStructure^ riskFreeRate, Cephei::QL::Termstructures::IYieldTermStructure^ dividendYield, Cephei::QL::IQuote^ s0, Double v0, Cephei::QL::Models::IParameter^ theta, Cephei::QL::Models::IParameter^ kappa, Cephei::QL::Models::IParameter^ sigma, Cephei::QL::Models::IParameter^ rho, Cephei::QL::ITimeGrid^ timeGrid) : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
    CYieldTermStructure^ _CriskFreeRate;
    CYieldTermStructure^ _CdividendYield;
    CQuote^ _Cs0;
    CParameter^ _Ctheta;
    CParameter^ _Ckappa;
    CParameter^ _Csigma;
    CParameter^ _Crho;
    CTimeGrid^ _CtimeGrid;
    try
    {
#ifdef HANDLE
        _phPiecewiseTimeDependentHestonModel = NULL;
#endif
        _CriskFreeRate = safe_cast<CYieldTermStructure^> (riskFreeRate);
        _CriskFreeRate->Lock();
        Handle<QuantLib::YieldTermStructure>& _riskFreeRate = static_cast<Handle<QuantLib::YieldTermStructure>&> (_CriskFreeRate->GetHandle ()); 
        _CdividendYield = safe_cast<CYieldTermStructure^> (dividendYield);
        _CdividendYield->Lock();
        Handle<QuantLib::YieldTermStructure>& _dividendYield = static_cast<Handle<QuantLib::YieldTermStructure>&> (_CdividendYield->GetHandle ()); 
        _Cs0 = safe_cast<CQuote^> (s0);
        _Cs0->Lock();
        Handle<QuantLib::Quote>& _s0 = static_cast<Handle<QuantLib::Quote>&> (_Cs0->GetHandle ()); 
        QuantLib::Real _v0 = (QuantLib::Real)ValueHelper::Convert (v0); //d
        _Ctheta = safe_cast<CParameter^> (theta);
        _Ctheta->Lock();
        QuantLib::Parameter& _theta = static_cast<QuantLib::Parameter&> (_Ctheta->GetReference ()); 
        _Ckappa = safe_cast<CParameter^> (kappa);
        _Ckappa->Lock();
        QuantLib::Parameter& _kappa = static_cast<QuantLib::Parameter&> (_Ckappa->GetReference ()); 
        _Csigma = safe_cast<CParameter^> (sigma);
        _Csigma->Lock();
        QuantLib::Parameter& _sigma = static_cast<QuantLib::Parameter&> (_Csigma->GetReference ()); 
        _Crho = safe_cast<CParameter^> (rho);
        _Crho->Lock();
        QuantLib::Parameter& _rho = static_cast<QuantLib::Parameter&> (_Crho->GetReference ()); 
        _CtimeGrid = safe_cast<CTimeGrid^> (timeGrid);
        _CtimeGrid->Lock();
        QuantLib::TimeGrid& _timeGrid = static_cast<QuantLib::TimeGrid&> (_CtimeGrid->GetReference ()); 
        _ppPiecewiseTimeDependentHestonModel = new boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel> (new QuantLib::PiecewiseTimeDependentHestonModel ( _riskFreeRate,  _dividendYield,  _s0,  _v0,  _theta,  _kappa,  _sigma,  _rho,  _timeGrid ));
        SetCalibratedModel (boost::dynamic_pointer_cast<QuantLib::CalibratedModel> (*_ppPiecewiseTimeDependentHestonModel));
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
        if (_CriskFreeRate != nullptr) _CriskFreeRate->Unlock();
        if (_CdividendYield != nullptr) _CdividendYield->Unlock();
        if (_Cs0 != nullptr) _Cs0->Unlock();
        if (_Ctheta != nullptr) _Ctheta->Unlock();
        if (_Ckappa != nullptr) _Ckappa->Unlock();
        if (_Csigma != nullptr) _Csigma->Unlock();
        if (_Crho != nullptr) _Crho->Unlock();
        if (_CtimeGrid != nullptr) _CtimeGrid->Unlock();
    }
}
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel>& childNative, Object^ owner) : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
#ifdef HANDLE
	_phPiecewiseTimeDependentHestonModel = NULL;
#endif
	_ppPiecewiseTimeDependentHestonModel = &childNative;
    _ppCalibratedModel = new boost::shared_ptr<QuantLib::CalibratedModel> (boost::dynamic_pointer_cast<QuantLib::CalibratedModel> (*_ppPiecewiseTimeDependentHestonModel));
}
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (QuantLib::PiecewiseTimeDependentHestonModel& childNative, Object^ owner) : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
#ifdef HANDLE
	_phPiecewiseTimeDependentHestonModel = NULL;
#endif
	_ppPiecewiseTimeDependentHestonModel = new boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel> (&childNative);
    _ppCalibratedModel = new boost::shared_ptr<QuantLib::CalibratedModel> (boost::dynamic_pointer_cast<QuantLib::CalibratedModel> (*_ppPiecewiseTimeDependentHestonModel));
    _PiecewiseTimeDependentHestonModelOwner = owner;
    _CalibratedModelOwner = owner;
}

Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (CPiecewiseTimeDependentHestonModel^ copy) : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
#ifdef HANDLE
	_phPiecewiseTimeDependentHestonModel = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppPiecewiseTimeDependentHestonModel = new boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel> (copy->GetShared());
        _ppCalibratedModel = new boost::shared_ptr<QuantLib::CalibratedModel> (boost::dynamic_pointer_cast<QuantLib::CalibratedModel> (*_ppPiecewiseTimeDependentHestonModel));
    }
}
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (PLATFORM::Type^ t) : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
#ifdef HANDLE
	_phPiecewiseTimeDependentHestonModel = NULL;
#endif
	if (!t->IsSubclassOf(CPiecewiseTimeDependentHestonModel::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (QuantLib::Handle<QuantLib::PiecewiseTimeDependentHestonModel>& childNative, Object^ owner)  : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
	_phPiecewiseTimeDependentHestonModel = &childNative;
	_ppPiecewiseTimeDependentHestonModel = &static_cast<boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel>>(childNative.currentLink());
    _ppCalibratedModel = new boost::shared_ptr<QuantLib::CalibratedModel> (boost::dynamic_pointer_cast<QuantLib::CalibratedModel> (*_ppPiecewiseTimeDependentHestonModel));
    _PiecewiseTimeDependentHestonModelOwner = owner;
}
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (QuantLib::Handle<QuantLib::PiecewiseTimeDependentHestonModel> childNative)  : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
	_phPiecewiseTimeDependentHestonModel = &childNative;
	_ppPiecewiseTimeDependentHestonModel = &static_cast<boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel>>(childNative.currentLink());
    _ppCalibratedModel = new boost::shared_ptr<QuantLib::CalibratedModel> (boost::dynamic_pointer_cast<QuantLib::CalibratedModel> (*_ppPiecewiseTimeDependentHestonModel));
}
#endif
#ifdef STRUCT
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::CPiecewiseTimeDependentHestonModel (QuantLib::PiecewiseTimeDependentHestonModel childNative)  : CCalibratedModel(CPiecewiseTimeDependentHestonModel::typeid)
{
#ifdef HANDLE
	_phPiecewiseTimeDependentHestonModel = NULL;
#endif
	_ppPiecewiseTimeDependentHestonModel = new boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel> (new QuantLib::PiecewiseTimeDependentHestonModel (childNative));
    _ppCalibratedModel = new boost::shared_ptr<QuantLib::CalibratedModel> (boost::dynamic_pointer_cast<QuantLib::CalibratedModel> (*_ppPiecewiseTimeDependentHestonModel));
}
#endif

Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::~CPiecewiseTimeDependentHestonModel ()
{
    if (_ppPiecewiseTimeDependentHestonModel != NULL)
    {
	    delete _ppPiecewiseTimeDependentHestonModel;
        _ppPiecewiseTimeDependentHestonModel = NULL;
    }
}
Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::!CPiecewiseTimeDependentHestonModel ()
{
    if (_ppPiecewiseTimeDependentHestonModel != NULL)
    {
	    delete _ppPiecewiseTimeDependentHestonModel;
    }
}
QuantLib::PiecewiseTimeDependentHestonModel& Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::GetReference ()
{
    if (_ppPiecewiseTimeDependentHestonModel == NULL) throw REFNEW NativeNullException ();
	return **_ppPiecewiseTimeDependentHestonModel;
}
boost::shared_ptr<QuantLib::PiecewiseTimeDependentHestonModel>& Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::GetShared ()
{
    if (_ppPiecewiseTimeDependentHestonModel == NULL) throw REFNEW NativeNullException ();
	return *_ppPiecewiseTimeDependentHestonModel;
}
QuantLib::PiecewiseTimeDependentHestonModel* Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::GetPointer ()
{
    if (_ppPiecewiseTimeDependentHestonModel == NULL) throw REFNEW NativeNullException ();
	return &**_ppPiecewiseTimeDependentHestonModel;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::PiecewiseTimeDependentHestonModel>& Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::GetHandle ()
{
	if (_phPiecewiseTimeDependentHestonModel == NULL)
	{
		_phPiecewiseTimeDependentHestonModel = new Handle<QuantLib::PiecewiseTimeDependentHestonModel> (*_ppPiecewiseTimeDependentHestonModel);
	}
	return *_phPiecewiseTimeDependentHestonModel;
}
#endif
bool Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::HasNative () 
{
	return (_ppPiecewiseTimeDependentHestonModel != NULL);
}

Cephei::QL::Termstructures::IYieldTermStructure^ Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::DividendYield::get ()
{
    try
    {
    	Handle<QuantLib::YieldTermStructure>& _rv = (Handle<QuantLib::YieldTermStructure>&)(*_ppPiecewiseTimeDependentHestonModel)->dividendYield ( );   
        Cephei::QL::Termstructures::CYieldTermStructure^ _nrv = REFNEW Cephei::QL::Termstructures::CYieldTermStructure (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::Kappa (Double t)
{
    try
    {
        QuantLib::Time _t = (QuantLib::Time)ValueHelper::Convert (t); //a
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppPiecewiseTimeDependentHestonModel)->kappa ( _t );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::Rho (Double t)
{
    try
    {
        QuantLib::Time _t = (QuantLib::Time)ValueHelper::Convert (t); //a
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppPiecewiseTimeDependentHestonModel)->rho ( _t );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Termstructures::IYieldTermStructure^ Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::RiskFreeRate::get ()
{
    try
    {
    	Handle<QuantLib::YieldTermStructure>& _rv = (Handle<QuantLib::YieldTermStructure>&)(*_ppPiecewiseTimeDependentHestonModel)->riskFreeRate ( );   
        Cephei::QL::Termstructures::CYieldTermStructure^ _nrv = REFNEW Cephei::QL::Termstructures::CYieldTermStructure (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::S0::get ()
{
    try
    {
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppPiecewiseTimeDependentHestonModel)->s0 ( );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::Sigma (Double t)
{
    try
    {
        QuantLib::Time _t = (QuantLib::Time)ValueHelper::Convert (t); //a
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppPiecewiseTimeDependentHestonModel)->sigma ( _t );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::Theta (Double t)
{
    try
    {
        QuantLib::Time _t = (QuantLib::Time)ValueHelper::Convert (t); //a
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppPiecewiseTimeDependentHestonModel)->theta ( _t );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::ITimeGrid^ Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::TimeGrid::get ()
{
    try
    {
    	QuantLib::TimeGrid& _rv = (QuantLib::TimeGrid&)(*_ppPiecewiseTimeDependentHestonModel)->timeGrid ( );   
        Cephei::QL::CTimeGrid^ _nrv = REFNEW Cephei::QL::CTimeGrid (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel::V0::get ()
{
    try
    {
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppPiecewiseTimeDependentHestonModel)->v0 ( );   
        Double _nrv = (Double)ValueHelper::Convert (_rv); //c
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

Cephei::QL::Models::Equity::IPiecewiseTimeDependentHestonModel^ Cephei::QL::Models::Equity::CPiecewiseTimeDependentHestonModel_Factory::Create (Cephei::QL::Termstructures::IYieldTermStructure^ riskFreeRate, Cephei::QL::Termstructures::IYieldTermStructure^ dividendYield, Cephei::QL::IQuote^ s0, Double v0, Cephei::QL::Models::IParameter^ theta, Cephei::QL::Models::IParameter^ kappa, Cephei::QL::Models::IParameter^ sigma, Cephei::QL::Models::IParameter^ rho, Cephei::QL::ITimeGrid^ timeGrid)
{
    return REFNEW CPiecewiseTimeDependentHestonModel ( riskFreeRate,  dividendYield,  s0,  v0,  theta,  kappa,  sigma,  rho,  timeGrid);
}
